import pandas as pd

# 读取Excel文件
input_file = 'your_output_file.xlsx'
df = pd.read_excel(input_file)

# 定义关键词列表
keywords_1 = ['中标', '签约', '签订', '签署']
keywords_2 = ['承建', '总承包', '建营', '参建', '投建', '援建','承揽','完成','建设','运维','交付']

# 遍历每一行，根据C列的内容在B列插入相应的值
for index, row in df.iterrows():
    c_column_value = str(row['sub_title'])
    
    # 检查C列是否包含关键词1
    if any(keyword in c_column_value for keyword in keywords_1):
        df.at[index, 'mark'] = 1
    # 检查C列是否包含关键词2
    elif any(keyword in c_column_value for keyword in keywords_2):
        df.at[index, 'mark'] = 2
    else:
        df.at[index, 'mark'] = 0

# 保存修改后的DataFrame回Excel文件
output_file = 'your_output_file2.xlsx'
df.to_excel(output_file, index=False)

print(f"数据已保存到 {output_file}")